<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.frame.session.UserSession"%>

<!DOCTYPE html>
<HTML>
  <head>
	<%@ include file="/platform/style.jsp"%>
	
	<script>
	$(function(){
		$("#channeltree").tree({
			url: ctx+"/information/InformationPage@loadChannelTree.page?bean.code=<%=request.getParameter("code")==null?"":request.getParameter("code")%>",
			onSelect:function(node){
				showList(node.id);
			}
		})
		showList("<%=request.getParameter("code")==null?"":request.getParameter("code")%>");
	})
	function showList(code){
		$w.execUrl(ctx+"/information/InformationPage@adList.page?bean.code="+code,{},$('#infoListPanel'));
	}
	function add(){
		var code="";
		var node=$("#channeltree").tree("getSelected");
		if(node==null){
			window.parent.$w.infoMsg("请先选择栏目");
			return false;
		}
		code=node.id;
		$w.openDialog({title:'新建广告',url:ctx+"/information/InformationPage@adshow.page?bean.code="+code,maximized:true,iframe:true,afterClose:function(re){
			if(re){
				$w.execForm();
			}
		}});
	}
	function edit(id){
		$w.openDialog({title:'编辑广告',url:ctx+"/information/InformationPage@adshow.page?bean.id="+id,maximized:true,iframe:true,afterClose:function(re){
			if(re){
				$w.execForm();
			}
		}});
	}
	function delall(){
		window.parent.$w.confirmMsg("确定删除？", function(r){
			if(r){
				$w.doUrl(ctx+"/information/InformationPage@del.page",$("#infoform").serializeArray(),function(json){
					if(json.state=='delok'){
						//删除成功，刷新
						$w.execForm();
					}
				})
			}
		})
	}
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'center',border:false">
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'west',split:true" title="广告位栏目" style="width:200px;padding-top:4px">
			<div id="channeltree"></div>
		</div>
		
		<div data-options="region:'center',split:true">
			<div id="infoListPanel" class="easyui-panel" border="false" data-options="doSize:false,href:''">
			</div>
		</div>
	</div>

	</div>
  </body>
</html>